var app = getApp();

Page({
    data: {
        current: -1,
        // 模拟数据
        jz_user:"",
        jzTypeId:'',
        scHeight:'',
        height:'',
        height1:'',
        height2:'',
        wHeight:'',
        vip1:'/hyb_jianzhi/images/vip1.png',
        vip2:'/hyb_jianzhi/images/vip2.png',
        vip3:'/hyb_jianzhi/images/vip3.png', 
    },
    onLoad: function(a) {
        var self = this,wHeight=wx.getSystemInfoSync().windowHeight-66;
        var query = wx.createSelectorQuery();
         self.getJianzhi_style();
        //选择id
       query.select('.start_bg').boundingClientRect(function (rect) {
        self.setData({
                 height: rect.height
                    })
        }).exec();
       query.select('.height1').boundingClientRect(function (rect) {
        self.setData({
                 height1: rect.height
                    })
        }).exec();
       query.select('.sort_wrap').boundingClientRect(function (rect) {
        self.setData({
                 height2: rect.height
                    })
        }).exec();
        console.log("加载数据格式"+wHeight-self.data.height);
         self.setData({
            wHeight:wHeight,
            scHeight:wHeight-self.data.height-self.data.height1-self.data.height2
         });
         self.getJz_top();
       },
     getJianzhi_style: function() {
        var i = this;
        app.util.request({
            url: "entry/wxapp/jianzhi_type",
            success: function(a) {
                i.setData({
                    array: a.data.data
                });
            }
        });
    },
    getJz_top:function(){
        var self = this;
        app.util.request({
            url: "entry/wxapp/Top",
            success: function(a) {
                self.setData({
                    jz_user: a.data.data
                });
            }
        });
    },
    navTab1: function(a) {
        var t = this;
        t.setData({
            current: -1
        });
        app.util.request({
            url: "entry/wxapp/Top",
            data:{
                type:''
            },
            success: function(a) {
                t.setData({
                    jz_user: a.data.data
                });
            }
        });
    },
    navTab: function(a) {
        var t = this;
        var e = a.currentTarget.dataset.index,jzTypeId=a.currentTarget.dataset.typeid;
        t.setData({
            current: e,
            jzTypeId:jzTypeId
        });
        app.util.request({
            url: "entry/wxapp/Top",
            data:{
                type:jzTypeId
            },
            success: function(a) {
                t.setData({
                    jz_user: a.data.data
                });
            }
        });
    },
});